
import pytest,os,HTMLTestRunner_cn,yagmail,logging

class Tools():
    def Log(self):
        log = logging.basicConfig(level=logging.DEBUG,
                                  filemode='a+',
                                  filename='baidu.log',
                                  format='%(levelname)s %(filename)s %(message)s %(lineno)d')
        return log
    def report_html(self):
        aa = HTMLTestRunner_cn.HTMLTestRunner(open('baidu1.html','wb'),title='标题')
        return aa

    def report_allure(self):
        # pytest.main(['-s','D:\Pycharm_Django\PyCharm\Data_10_12\src\Case\Case.py','--clean-alluredir','--alluredir=./report'])
        os.system('allure generate ./report -o ./html --clean')
    def Email(self):
        email = yagmail.SMTP(user='gw17518836160@126.com',password='LMXtkMbwLThAcn7H',host='smtp.126.com')
        email.send(to='3153075207@qq.com',subject='百度主题',contents='百度内容:日志,报告',attachments=['baidu.log','baidu1.html'])